package com.motorwaymanage.impl;

import java.io.IOException;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.motorwaymanage.beans.SheBeiInfo;
import com.motorwaymanage.biz.ISheBeiInfoBiz;
import com.motorwaymanage.dao.DBAccess;

public class SheBeiInfoBizImpl implements ISheBeiInfoBiz{
	private DBAccess db=new DBAccess();

	@Override
	public int addSheBeiInfo(SheBeiInfo sbi) {
		SqlSession session=null;
		int result=0;
		try {
			session=db.getSqlSession();
			ISheBeiInfoBiz sheBeiInfoBiz = session.getMapper(ISheBeiInfoBiz.class);
			result=sheBeiInfoBiz.addSheBeiInfo(sbi);
			session.commit();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}

	@Override
	public List<SheBeiInfo> getSheBeiList() {
		SqlSession session=null;
		List<SheBeiInfo> result=null;
		try {
			session=db.getSqlSession();
			ISheBeiInfoBiz sheBeiInfoBiz = session.getMapper(ISheBeiInfoBiz.class);
			result=sheBeiInfoBiz.getSheBeiList();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			session.close();
		}
		return result;
	}

}
